﻿@using MyBlog
@{
    var models = ViewData["models"] as List<MsgReplyModel>;
    var count = (int)ViewData["count"];
    if (models.Count > 0)
    {
        int i = 0;
        <div class="dv-msg-rep-main">
            <div class="rep-tip-main">
                <div class="rep-line-long"></div>
                <div class="rep-tip-center-long"> 共@(models.Count)个回复&nbsp;<a href="javascript:;" onclick="flodReply(this)">折叠</a></div>
                <div class="rep-line-long"></div>
            </div>
            @foreach (var rep in models)
            {
                i++;
                var repUser = WebCache.GetAccount(rep.ReplyUid);
                <div class="dv-rep-msg-com-main">
                    <div class="dv-rep-msg-com-main-header">
                        <a href="@Url.Content("~/" + rep.ReplyUid)">
                            @if (repUser.HeadId.HasValue && repUser.HeadId.Value > 0)
                            {
                                <img src="@Url.Action("GetUserHeadByUid", "account", new { uid = rep.ReplyUid })" />
                            }
                            else
                            {
                                <img src="~/Content/Images/zanwutouxiang.jpg" />
                            }  
                        </a>
                    </div>
                    <div class="dv-rep-msg-com-main-body">
                        <div class="dv-rep-msg-com-main-body-header">
                            <span>
                                <span class="spfloor-rep">#@(i)层</span>&nbsp;
                                <span class="spuid">@repUser.NickName </span>
                                <span class="sptime">@rep.ReplyTime.ToString("yyyy-MM-dd HH:mm")</span>
                            </span><br />
                            <span class="spcontent ueditorContent">@HttpUtility.HtmlEncode(Html.Raw(rep.Content))</span>
                        </div>
                        <div class="dv-rep-msg-com-main-body-footer">
                            <span>
                                <a href="javascript:;" onclick="replyMsg(@count,0,@rep.Message.ID,'@repUser.NickName')"><i class="icon-reply"></i> 回复</a>
                            </span> 
                            <span>
                                <a href="javascript:;" onclick="agreeReply(@rep.ID,@rep.AgreeCount,this)"><i class="icon-heart"></i> 赞(@rep.AgreeCount)</a>
                            </span>
                            @if (UserSession.LoginUserInfo != null && UserSession.LoginUserInfo.IsAdmin)
                            {
                                <span>
                                    <a href="javascript:;" title="删除这个楼层" onclick="delRpMsg(@rep.ID)"><i class="icon-remove"></i> 删除</a>
                                </span>
                            }
                        </div>
                    </div>
                </div>
            }
        </div>
    }
}